Repository navigation
Conversation
StreamNetworkImage, and so StreamAvatar, decoded every image at its full size. It now reads the image's size first, refuses images larger than 8192 by 8192 pixels, and decodes the rest within the size it is shown at, at most 4096 pixels on a side, keeping the aspect ratio. Given both cacheWidth and cacheHeight, the image is fitted within them instead of stretched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A failed load is removed from the image cache, so retrying fetches the image again instead of showing the same error. - An image that covers its box, such as an avatar, is decoded large enough to fill it rather than to fit inside it. - An image already on disk shows without the loading placeholder, as before. - The size check runs as part of decoding, and the docs note it doesn't apply on web. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also decodes a BoxFit.none image at its own size, since it is drawn at that size, and checks a rebuild keeps the same image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Takes a nullable width and height with useLogicalSize, like ResizeImage, so the device pixel ratio comes from the image configuration rather than from MediaQuery in build. Rounds down like ResizeImagePolicy.fit, and fills the box for every fit that fills it, as Coil does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Returns the empty image itself, as OctoImage does, rather than a box of the same size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The state listens to the image stream itself, as Image does, instead of setting the error flag from errorBuilder, and every widget showing a failed URL retries when the retry listenable notifies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
errorBuilder runs for each widget showing the error, including widgets that share one image stream, so a separate stream listener isn't needed. The flag is cleared when the URL or cache key changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decoded images are cached under the bounded image's key, which CachedNetworkImage.evictFromCache doesn't know, so evictFromCache left them in memory and the old image kept showing. StreamBoundedImage now remembers the keys it creates for each image, and evictFromCache evicts them all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Covers tapping the retry badge and notifying the retry listenable for the same URL, against a local server that fails until it recovers. Each test has its own file because the image cache manager is shared app-wide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the separate error, placeholder, cache-check and retry flags with one load state (checkingCache, loading, loaded, failed) and a generation counter. Loads and errors come from an image stream listener, since Image keeps its last error across a source change and kept setting the old error flag again. Any change to the image or its decoded size now restarts the state, so a failed image that loads at a new size no longer reloads on a retry notification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
opacity, semanticLabel and excludeFromSemantics were accepted but never reached the image. The gallery playground gains an opacity knob. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e registry The state's own image listener skipped Flutter's deferred loading while a list is flung fast, kept animated images decoding while hidden, and never released the image handles it was given. It is gone: like FadeInImage, the state records loaded in frameBuilder and failed in errorBuilder, and Image is remounted for each new source, so it carries no old error. The registry of decoded sizes used by evictFromCache now forgets images no longer in the image cache once it tracks more than the cache can hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of FLU-1377
What
StreamNetworkImage, and soStreamAvatar, decoded every image at its full size, whatever size it was shown at. It now decodes images for the size they're shown at, like Flutter'sResizeImageand Coil:cacheWidth/cacheHeightwhen given, otherwisewidth/height× the device pixel ratio, fitted with the aspect ratio kept and never enlarged. Fits that fill the box (cover,fill,fitWidth,fitHeight) decode large enough to fill it, so non-square avatars stay sharp. Every image is capped at 4096 px on a side.StreamBoundedImage(internal) implements this on top ofCachedNetworkImageProvider, modelled onResizeImage.StreamNetworkImagerenders a FlutterImagewith it in place of theCachedNetworkImagewidget, which can't take a custom provider. Loading, the shared disk cache, placeholders, the cache-hit check and retry behave as before. LikeFadeInImage, it tracks loading fromImage's ownframeBuilderanderrorBuilder, soImagealone listens to the image: loads still wait while a list is flung fast, and hidden animated images pause.evictFromCachealso removes every decoded size of the image from memory. The sizes it tracks are forgotten once they leave the image cache.opacity,semanticLabelandexcludeFromSemanticsnow apply; they were accepted but never reached the image. The gallery playground has an opacity knob.Behaviour changes, in the CHANGELOG:
cacheWidthwithcacheHeightnow fits instead of stretching, and images over the size limit show the error builder.Verified
retryListenable, andevictFromCacheclears the decoded image.StreamAvatar: a 6000×4000 photo decodes at 180×120, and a 14,500² image is refused with peak memory flat (about 240 MB, against about 1 GB before).dart analyze --fatal-infos,dart formatandcheck:barrelspass. The only local test failures are macOS golden variants, identical onmain.🤖 Generated with Claude Code